<?php
/**
 * Created by PhpStorm.
 * User: HLG
 * Date: 2019/10/17
 * Time: 9:47
 */
namespace app\api\model;
class Region extends BaseModel
{
    protected $table = 'yoshop_region';

    /**
     * 查询省市区
     *
     * @return array
     * @throws \think\db\exception\DataNotFoundException
     * @throws \think\db\exception\ModelNotFoundException
     * @throws \think\exception\DbException
     */
    public function getRegion()
    {
        $pid = input('id')?:0;
        $list = $this->getList(['pid'=>$pid],['id','name']);
        if($list){
            $status = ['code'=>1,'msg'=>'查询成功','data'=>$list];
        }else{
            $status = ['code'=>0,'msg'=>'暂无数据','data'=>''];
        }
        return $status;
    }

}